using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace OrderingSystem.Core.Entities
{
    [Table("dingdanxinxi")]
    public class Order
    {
        [Column("id")]
        public long id { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        [Column("addtime")]
        public DateTime addtime { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        [Column("dingdanbianhao")]
        public string dingdanbianhao { get; set; }

        /// <summary>
        /// 菜品名称
        /// </summary>
        [Column("caipinmingcheng")]
        public string caipinmingcheng { get; set; }

        /// <summary>
        /// 菜品分类
        /// </summary>
        [Column("caipinfenlei")]
        public string caipinfenlei { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        [Column("tupian")]
        public string tupian { get; set; }

        /// <summary>
        /// 菜品价格
        /// </summary>
        [Column("caipinjiage")]
        public int? caipinjiage { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        [Column("shuliang")]
        public int shuliang { get; set; }

        /// <summary>
        /// 总金额
        /// </summary>
        [Column("zongjine")]
        public string zongjine { get; set; }

        // This property is handled in memory only and not persisted to the database
        [NotMapped]
        public decimal dingdanjine { get; set; }

        /// <summary>
        /// 下单时间
        /// </summary>
        [Column("xiadanshijian")]
        public DateTime xiadanshijian { get; set; }

        /// <summary>
        /// 送餐地址
        /// </summary>
        [Column("songcandizhi")]
        public string songcandizhi { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Column("yonghuming")]
        public string yonghuming { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [Column("lianxidianhua")]
        public string lianxidianhua { get; set; }

        /// <summary>
        /// 是否审核
        /// </summary>
        [Column("sfsh")]
        public string sfsh { get; set; } = "否";

        /// <summary>
        /// 审核回复
        /// </summary>
        [Column("shhf")]
        public string shhf { get; set; }

        /// <summary>
        /// 是否支付
        /// </summary>
        [Column("ispay")]
        public string ispay { get; set; } = "未支付";

        /// <summary>
        /// 用户id
        /// </summary>
        [Column("userid")]
        public long userid { get; set; }

        [ForeignKey("userid")]
        public virtual User User { get; set; }
    }

    public class OrderItem : BaseEntity
    {
        public long OrderId { get; set; }
        public Order Order { get; set; }
        public long DishId { get; set; }
        public Dish Dish { get; set; }
        public int Quantity { get; set; }
        public decimal Price { get; set; }
        public string Remarks { get; set; }
    }
} 